package betaclass.web.test;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import betaclass.biz.test.TestService;
import betaclass.dao.test.model.TestDo;
import betaclass.web.base.BaseController;

@Controller
@RequestMapping("/welcome.html")
public class HelloController extends BaseController {

	@RequestMapping(method = RequestMethod.GET)
	public String printWelcome(ModelMap model, 
			HttpServletRequest request, HttpServletResponse response) {
		 String name = request.getParameter("name");
		 String memo = request.getParameter("memo");
		 TestDo testDo = new TestDo();
		 testDo.setName(name);
		 testDo.setMemo(memo);
		 
		 List<TestDo> testDoList = testService.list(testDo);
		 
		 model.addAttribute("person", testDoList);
		model.addAttribute("message", "Spring 3 MVC Hello World");
		return "welcome";
 
	}
	
}
